package com.et114.modules.reg;

import com.et114.core.services.impl.BaseServicesImpl;
import com.et114.modules.cust.BIZ;
import com.et114.modules.cust.dao.IMng_CustDao;
import com.et114.modules.cust.vo.CustBaseVo;
import com.et114.modules.org.services.OrgFactory;
import com.et114.modules.org.services.UserManager;
import com.et114.modules.org.vo.UserVo;

public class Reg_ServiceImp  extends BaseServicesImpl {
	
	private IMng_CustDao mng_CustDao;

	public void setMng_CustDao ( IMng_CustDao mng_CustDao ) {
		this.mng_CustDao = mng_CustDao;
	}
	
	public void insertRegUser(UserVo user,CustBaseVo vo) throws Exception{
		UserManager userBean  = OrgFactory.getUserManager ( ) ; 
		Long userid=userBean.createUser ( user ) ; 
		if(userid==null) throw new Exception("注册失败!");
		
		vo.setCusttype ( BIZ.CUST_LEAD );
		vo.setCustlever ( "1" );//1普通,2优秀
		vo.setComerrom ( BIZ.CUST_SRC_REG );
		vo.setCustflag ( "0" );//0,正常,1 删除
		vo.setReguserid ( userid.intValue ( ) );
		
		mng_CustDao.insertCustBaseInfo ( vo );
	}
	
}
